package JUC.同步_syn;

import org.openjdk.jol.info.ClassLayout;

/**
 * 看 对象头 是什么
 * syn 标记位 在这里
 */
public class testClassLayout {

    public static void main(String[] args) {
        String s = ClassLayout.parseInstance(myLock).toPrintable();
        System.out.println(String.format(
                "-> %s",
                s
        ));
        testSyn();
    }
    static MyLock myLock = new MyLock();
    public static void testSyn(){
        synchronized (myLock) {
            String s = ClassLayout.parseInstance(myLock).toPrintable();
            System.out.println(String.format(
                    "--> %s",
                    s
            ));
            System.out.println("1");
            System.out.println("2");
            System.out.println("3");
        }
    }
}
